//
//  CustomBigScrollView.m
//  UI06_homework2
//
//  Created by aaaaaa on 16/6/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CustomBigScrollView.h"
#import "CustomSmallScrollView.h"

@implementation CustomBigScrollView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (void)dealloc
{
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setProperty];
    }
    return self;
}

- (void)setProperty{

    self.showsHorizontalScrollIndicator = NO;
    self.showsVerticalScrollIndicator = NO;
    self.pagingEnabled = YES;
    self.bounces = NO;
    self.minimumZoomScale = 0.5;
    self.maximumZoomScale = 2.0;

}

- (void)addScrollView:(NSArray<CustomSmallScrollView *> *)scrollArray{
    self.contentSize = CGSizeMake(CGRectGetWidth(self.bounds) * scrollArray.count, CGRectGetHeight(self.bounds));
    for (int i = 0; i < scrollArray.count; i++) {
        scrollArray[i].frame = CGRectMake(CGRectGetWidth(self.bounds) * i, 0, CGRectGetWidth(self.bounds), CGRectGetHeight(self.bounds));
        scrollArray[i].delegate = self;
        [self addSubview:scrollArray[i]];
    }
}

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
    
    
    return scrollView.subviews.firstObject;
}












@end
